package com.cn;

public class Book {
    private String name;
    private int price;
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    /**
     * 构造方法的重载
     */

    public Book(){
        System.out.println("构造方法一");
    }

    /**
     * 传入一个参数
     *
     * @param name
     */
    public Book(String name){
        this.name = name;
        System.out.println("构造方法二");
    }

    /**
     * 传入两个参数
     *
     *
     * @param name
     * @param price
     */
    public Book(String name,int price){
        this.name = name;
        this.price = price;
        System.out.println("构造方法三");

    }

    /**
     * 定义方法read()
     *
     *
     */
    public void read(){
        this.price = price;
        this.name = name;
        System.out.println("书名："+this.name+",单价："+this.price);
    }








}
